﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once

#include "GcmpModelInterface.h"
#include "IObject.h"
#include "RegenDataId.h"
#include "GcmpApiDeclaration.h"

namespace gcmp
{
    class IDocument;
    class ICalculator;

    /// \brief 关联更新计算器的收集器
    FINAL_INTERFACE class GCMP_MODEL_INTERFACE_EXPORT ICalculatorCollection : public IObject
    {
        DEFINE_CAST_DERIVED(gcmp::ICalculatorCollection, gcmp::IObject);
    public:
        /// \brief 析构函数
        virtual ~ICalculatorCollection() {};

        /// \brief 创建关联更新计算器的收集器
        /// \param pDocument 当前文档指针
        /// \return 创建得到的关联更新计算器的收集器
        static OwnerPtr<ICalculatorCollection> Create(IDocument* pDocument);

        /// \brief 添加关联更新计算器
        /// \param opCalculator 关联更新计算器指针
        /// \param canOverrideRegenData 是否允许对被手动设置值的关联更新数据进行覆盖，true表示允许，false表示不允许
        /// \return void
        virtual void AddCalculator(OwnerPtr<ICalculator> opCalculator, bool canOverrideRegenData) = 0;

        /// \brief 获取Collection中所有计算器的输出数据的RegenDataId
        /// \return Collection中所有计算器输出数据的集合
        virtual std::vector<RegenDataId> GetAllOutputDataIds() const = 0;

        /// \brief 通过索引获取计算器
        /// \param index 计算器在Collection中的索引值
        /// \return 对应索引的计算器的指针
        virtual const ICalculator* GetCalcualtorByIndex(int index) const = 0;

        /// \brief 获取Collection中包含计算器的数量
        /// \return Collection中包含的计算器的数量
        virtual int GetCalculatorCount() const = 0;
        
    };
}


